<?php
// select revisions for specific page, etc
if($_GET['what'] == "revisions" || $_GET['what'] == "") {
  $template = "revision.php";
  if(!$_GET['page'] == "") {
    $doctitle = $config['name']." | ".$_GET['page']." &raquo; revisions";
    $doclink = getURL('special','revisions')."?page=".$_GET['page'];
    $items = sqlite_fetch_all(sqlite_query($db,"SELECT * FROM revisions WHERE pageid = '".getIdFromName($_GET['page'])."' ORDER BY time DESC"));
  } else {
    $doctitle = $config['name']." | all revisions";
    $doclink = getURL('special','revisions');
    $items = sqlite_fetch_all(sqlite_query($db,"SELECT * FROM revisions ORDER BY time DESC"));
  }
} else if($_GET['what'] == "discussion") {
  $template = "comment.php";
  if(!$_GET['page'] == "") {
    $doctitle = $config['name']." | ".$_GET['page']." &raquo; discussion";
    $doclink = getURL('discuss',$_GET['page']);
    $items = sqlite_fetch_all(sqlite_query($db,"SELECT * FROM comments WHERE pageid = ".getIdFromName($_GET['page'])." ORDER BY time DESC"));
  } else {
    $doctitle = $config['name']." | all disscussion";
    $doclink = getLink('show','_index');
    $items = sqlite_fetch_all(sqlite_query($db,"SELECT * FROM comments ORDER BY time DESC"));
  }
}
?>